#/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time    : 2022/1/17 8:36
# @Author  : 魏袁月
# @Email   : 1915059545@qq.com
# @File    : page_setup_personal.py
# @Software: PyCharm
"""修改个人资料的页面"""
from pages.page_base import PageBase
from selenium.webdriver.common.by import By
from time import  sleep
class PageSetupPersonal(PageBase):
    #个人资料4
    grzl_locator=(By.XPATH,'//android.widget.RelativeLayout[@resource-id="com.gfeng.daydaycook:id/detailLayout"]')
    #用户名5
    yhm_locator=(By.ID,'com.gfeng.daydaycook:id/edt_nickname')
    #性别男6
    sex_locator=(By.ID,"com.gfeng.daydaycook:id/rbt_boy")
    #个人简介7
    grjj_locator=(By.ID,"com.gfeng.daydaycook:id/edt_intro")
    #保存8
    bc_locator=(By.ID,"com.gfeng.daydaycook:id/rightButton")
    #点击设置按钮3
    shezhi_locator=(By.XPATH,'com.gfeng.daydaycook:id/menuIv')
    #点击设置2
    setup_locator=(By.XPATH,'//android.widget.TextView[@text="设置"]')
    #点击我的1
    wd_locator=(By.XPATH,'//android.widget.TextView[@text="我的"]')

    def ele_wd(self):
        """点击主页面我的"""
        self.driver.find_element(*self.wd_locator).click()
    def ele_sz(self):
        """点击左上角设置按钮"""
        self.driver.find_element(*self.setup_locator).click()
    def ele_sz_set(self):
        """点击进入个人设置界面"""
        self.driver.find_element(*self.shezhi_locator).click()
    def ele_grzl(self):
        """点击个人资料"""
        self.driver.find_element(*self.grzl_locator).click()
    def ele_yhm(self):
        """输入用户名"""
        self.driver.find_element(*self.yhm_locator).send_keys("林俊杰")
    def ele_sex(self):
        """点击选择性别男"""
        self.driver.find_element(*self.sex_locator).click()
    def ele_grjj(self):
        """点击输入个人简介"""
        self.driver.find_element(*self.grjj_locator).send_keys("你好")
    def ele_bc(self):
        """点击保存"""
        self.driver.find_element(*self.bc_locator).click()
    #修改个人资料功能
    def setup_personal(self):
        self.ele_wd()
        sleep(4)
        self.ele_sz()
        sleep(4)
        self.ele_sz_set()
        sleep(4)
        self.ele_grzl()
        sleep(4)
        self.ele_yhm()
        sleep(4)
        self.ele_sex()
        sleep(4)
        self.ele_grjj()
        sleep(4)
        self.ele_bc()
        sleep(4)